#include<bits/stdc++.h>

using namespace std;

#define lowbit(x) (x & (-x))

typedef long long ll;

const int N = 200010;

int n;
int a[N];
int tr[N];
int g[N],l[N];

void add(int x, int c)
{
	for(int i = x; i <= n; i += lowbit(i)) tr[i] += c;
}

ll sum(int x)
{
	int res = 0;
	for(int i = x; i; i -= lowbit(i)) res += tr[i];
	return res;
}

int main()
{
	cin>>n;
	
	for(int i = 1; i <= n; i ++ ) cin>>a[i];
	
	for(int i = 1; i <= n; i ++ )
	{
		int s = a[i];
		g[i] = sum(n) - sum(s);
		l[i] = sum(s - 1);
		add(s, 1);
	}
	memset(tr, 0, sizeof tr);
	ll s1 = 0, s2 = 0;
	for(int i = n; i; i --)
	{
		int s = a[i];
		s1 += g[i] * (sum(n) - sum(s));
		s2 += l[i] * sum(s - 1);
		add(s, 1);
	}
	cout<<s1<<" "<<s2;
	return 0;
}

